home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / gcc / ixemlsrc.lha / ixemul / general / uname.c < prev    next >
C/C++ Source or Header  |  1996-03-13  |  2KB  |  67 lines

  1. /*
  2.  *  This file is part of ixemul.library for the Amiga.
  3.  *  Copyright (C) 1995 Lars G. Hecking
  4.  *
  5.  *  This library is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU Library General Public
  7.  *  License as published by the Free Software Foundation; either
  8.  *  version 2 of the License, or (at your option) any later version.
  9.  *
  10.  *  This library is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  *  Library General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU Library General Public
  16.  *  License along with this library; if not, write to the Free
  17.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  *  $Id: uname.c 1.1 1995/12/02 17:49:30 lhecking Exp lhecking $
  20.  *
  21.  *  $Log: uname.c $
  22.  * Revision 1.1  1995/12/02  17:49:30  lhecking
  23.  * Initial revision
  24.  *
  25.  *
  26.  */
  27. #include <sys/utsname.h>
  28.  
  29. #define KERNEL
  30. #include "ixemul.h"
  31. #include "kprintf.h"
  32. #include <stdio.h>
  33. #include <string.h>
  34. #include <unistd.h>
  35.  
  36. static char sysname[] = "AmigaOS";
  37. static char version[] = "1";
  38. static char machine[] = "amiga";
  39.  
  40. int
  41. uname (struct utsname *name)
  42. {
  43.   char host[__SYS_NMLN];
  44.   char release[__SYS_NMLN];
  45.   int res = -1, err = EFAULT;
  46.  
  47.   if (name)
  48.     {
  49.  
  50.       if (gethostname(&host[0],__SYS_NMLN) == 0)
  51.     {
  52.  
  53.       sprintf (release, "%d.%d", SysBase->LibNode.lib_Version, SysBase->SoftVer);
  54.       strncpy (name->sysname, sysname,__SYS_NMLN);
  55.       strncpy (name->nodename, &host[0],__SYS_NMLN);
  56.       strncpy (name->release, release,__SYS_NMLN);
  57.       strncpy (name->version, version,__SYS_NMLN);
  58.       strncpy (name->machine, machine,__SYS_NMLN);
  59.       res = err = 0;
  60.     }
  61.     }
  62.  
  63.   errno = err;
  64.   KPRINTF (("&errno = %lx, errno = %ld\n", &errno, errno));
  65.   return res;
  66. }
  67.